package a1;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class A04_test {
    public static void main(String[] args) throws ParseException {
//        JDK7
        String birthday = "2000年1月1日";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = sdf.parse(birthday);
        long birthdayTime = date.getTime();
        long newTime = System.currentTimeMillis();
        long timeDiff = newTime - birthdayTime;
        System.out.println(timeDiff / 1000 / 60 / 60 /24);

//        JDK8
        LocalDate ld1 = LocalDate.of(2000,1,1);
        LocalDate ld2 = LocalDate.now();
        long days = ChronoUnit.DAYS.between(ld1, ld2);
        System.out.println(days);

    }
}
